package com.bite.system.Controller;


import com.bite.system.DTO.QuestionAddDTO;
import com.bite.system.DTO.QuestionDTO;
import com.bite.system.DTO.QuestionEditDTO;
import com.bite.system.Service.QuestionService;
import com.bite.system.VO.QuestionAddVO;
import domain.R;
import domain.TableDataInfo;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/question")
/**
 * 题目管理
 */
public class QuestionController {

    @Autowired
    private QuestionService questionService;

    /**
     * 题目列表
     * @param questionDTO
     * @return
     */
    @GetMapping("/list")
    public TableDataInfo list(QuestionDTO questionDTO){
        return questionService.list(questionDTO);
    }


    /**
     * 添加题目
     * @param questionAddDTO
     * @return
     */
    @PostMapping("/add")
    public R<Void> add(@RequestBody QuestionAddDTO questionAddDTO){
        return questionService.add(questionAddDTO);
    }

    /**
     * 获取题目详情
     * @param questionId
     * @return
     */
    @GetMapping("/detail")
    public R<QuestionAddVO> detail(Long questionId){
        return questionService.detail(questionId);
    }

    /**
     * 修改题目
     * @param questionEditDTO
     * @return
     */
    @PutMapping("/edit")
    public R<Void> edit(@RequestBody QuestionEditDTO questionEditDTO){
        return questionService.edit(questionEditDTO);

    }

    /**
     * 删除题目
     * @param questionId
     * @return
     */
    @DeleteMapping("/delete")
    public R<Void> delete(Long questionId){
        return questionService.delete(questionId);
    }






}
